package com.quarkus.service;

import com.quarkus.bean.Fruit;
import lombok.extern.slf4j.Slf4j;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.validation.Validator;

/**
 * @version v1.0
 * @Description: TODO(一句话描述该类的功能)
 * @Author: TongRui乀
 * @Date: 2021/1/31 5:34 下午
 */
@Slf4j
@ApplicationScoped
public class FruitServiceImpl {

    @Inject
    Validator validator;

    public void validate(@Valid Fruit fruit){

      log.info("{}", fruit.toString());

    }

    public void validateV2(Fruit fruit){

        validator.validate(fruit, Fruit.class);

        log.info("{}", fruit.toString());

    }



}
